<%@page import="com.demo.ProductDetails"%>
<%@page import="java.util.List"%>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
	pageEncoding="ISO-8859-1"%>
	<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<script type="text/javascript">
  

</script>
<body id="body"> 
	 <div style="float:  left;">
	 <c:if test="${not empty  errorMsg}">      <!-- expression lang does not accept null ,if not empty 
	                                                then some error has occurred -->
	  <span style="color: red;"> ${errorMsg}</span>
	 </c:if>

	 <form action="AddToCartServlet">
	<table>
		<thead>
	<tr>
	   <th>Index </th>
			<th>Product Id </th>
			<th>Product Name</th>
			<th>Quantity</th>
			<th>Price</th>
			<th>Add</th>
			</tr>
		</thead>
      
      <c:remove var="selectedPro"  scope="session"/> 
      
		<c:forEach var="product" items="${productList}" varStatus="status" >
		  <tr>
		    <td> ${status.index}</td>
		    <td>${product.productId}</td>
		  <td>${product.productName}</td>
		  <td>${product.quantity}</td>
		  <td>${product.price}</td>
		   <td><input type="checkbox"  name="productId" value="${product.productId }"></td>
		  
		   </tr>
		
		
		</c:forEach> 
		</table>     
		        <input type="submit" value="Add to cart">
		        </form>
		        
		        </div>
		           <c:if test="${cartInfo.size()>0}" >
		           <c:url var="url" value="ViewCartInfo" ></c:url>
		         <div> Cart Size ( <a href="${url}">${cartInfo.size()}</a>)</div>
		         </c:if>
		         
		      <c:out value="${hacking}" ></c:out>   
</body>
</html>